//
//  MBAAlertView.swift
//  chat
//
//  Created by 1 on 2023/7/26.
//

import SwiftUI

struct MBAAlertView: View {
    var title:String
    var leftBtnTitle:String = "取消"
    var rightBtnTitle:String = "确定"
    var actionLeftBtn: () -> Void
    var actionRightBtn: () -> Void
    
    var body: some View {
        VStack(spacing:0){
            Text(title)
                .font(.system(size: 18).bold())
                .foregroundColor(MBAColor.com_white.color)
                .padding(.top,6)
                .multilineTextAlignment(.center)
            HStack(spacing:16){
                Button(action: actionLeftBtn) {
                    Text(leftBtnTitle)
                        .font(.system(size: 16).bold())
                        .foregroundColor(MBAColor.com_white.color)
                        .frame(height: 44)
                        .frame(maxWidth: .infinity)
                        .background(MBAColor.com_textBg_second.color)
                        .cornerRadius(22)
                }
                Button(action: actionRightBtn) {
                    Text(rightBtnTitle)
                        .font(.system(size: 16).bold())
                        .frame(height: 44)
                        .frame(maxWidth: .infinity)
                        .mainGradientTitle()
                        .cornerRadius(22)
                }
            }
            .padding(.top,24)
        }
        .padding(16)
        .frame(width: 280)
        .background(MBAColor.com_background.color)
        .cornerRadius(16)
    }
}

struct MBAAlertView_Previews: PreviewProvider {
    static var previews: some View {
        MBAAlertView(title: "AI正在生成内容，退出将导致生成失败，是否继续？") {
            
        } actionRightBtn: {
            
        }
    }
}
